<!-----------------------------------这里写的是底部菜单的共同组件-------------------------------------------------------->



<template>
    <ul class="footer">
        <li onclick="location.href='/index'">
            <i class="fa fa-home"></i>
            <p>首页</p>
        </li>
        <li>
            <i class="fa fa-compass"></i>
            <p>发现</p>
        </li>
        <li onclick="location.href='/orderList'">
            <i class="fa fa-file-text-o"></i>
            <p>订单</p>
        </li>
        <li @click="to_user">
            <i class="fa fa-user-o"></i>
            <p>我的</p>
        </li>
    </ul>
</template>

<script>
    export default {
    name: 'Footer',
    data() {
        return {
            user: {}
        }
    },
    created() {
        this.user = this.$getSessionStorage('user');
    },
    methods: {
        to_user(){
            //首先做登录验证
            if (this.user == null) {
                this.$router.push({
                    path: '/login'
                });
                return;
            } else {
                this.$router.push({
                    path: '/user'
                });
            }
        }
    }
}
</script>
    
<style>
    
/************底部菜单**********/
.footer{
    justify-content: space-around;
    display: flex;
    align-items: center;
    width: 100vw;
    height: 14vw;
    border-top: solid 1px #ddd;
    background-color: #fff;
    position: fixed;
    left: 0;
    bottom: 0;
    z-index: 1000;
}
.footer li{
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;

    user-select: none;
    cursor: pointer;
    color: #999;
}

.footer li img{
    width: 5vw;
    height: 5w;
}
.footer li p{
    font-size: 3vw;
}
.footer li i{
    font-size: 5vw;
}
</style>